package com.cys.dm.rabbitService;

import com.cys.dm.client.order.DmOrderClient;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author blue_t
 * @date 2020-12-27 10:20
 */
@Component
@RabbitListener(queues = {"dm-order-back"})
public class OrderRabbitBack {
    @Autowired
    private DmOrderClient dmOrderClient;

    /**
     * 回滚订单
     * @param orderNo 订单编号
     */
    @RabbitHandler
    public void orderRollBack(String orderNo){
        dmOrderClient.delOrder(orderNo);
        System.out.println("订单已删除");
    }

}
